package com.loongxun.playwithyou.network;

import android.util.Log;

import com.loopj.android.http.TextHttpResponseHandler;

import org.json.JSONException;
import org.json.JSONObject;

import cz.msebera.android.httpclient.Header;

/**
 * Created by Administrator on 2017/7/13.
 */
public abstract class MyHttpRespenseHandler extends TextHttpResponseHandler {

    private String TAG = "respensehandler";

    @Override
    public void onSuccess(int i, Header[] headers, String s) {
        Log.i(TAG, "请求成功");
        success(s);
    }

    @Override
    public void onFailure(int i, Header[] headers, String s, Throwable throwable) {
        Log.i(TAG, "请求失败");
        faile("请求失败");
    }

    @Override
    public void onFailure(int statusCode, Header[] headers, byte[] responseBytes, Throwable throwable) {
        super.onFailure(statusCode, headers, responseBytes, throwable);
        faile("网络连接超时");
    }

    public abstract  void success(String json);
    public abstract void faile(String json);
}
